# Maintainer: Luca Weiss <luca@z3ntu.xyz>
# Contributor: Brandon Boese <brandonboese@protonmail.com>
pkgname=lomiri-history-service
pkgver=0.4
pkgrel=1
pkgdesc="Service that provides call log and conversation history"
url="https://gitlab.com/ubports/development/core/history-service"
arch="all"
license="GPL-3.0-only"
depends="
	qt5-qtbase-sqlite
	telepathy-mission-control
	"
makedepends="
	cmake
	cmake-extras
	dconf
	libphonenumber-dev
	libqtdbustest
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtpim-dev
	samurai
	sqlite-dev
	telepathy-qt-dev
	"
checkdepends="
	dbus-test-runner
	xvfb-run
	"
subpackages="$pkgname-dev"
source="https://gitlab.com/ubports/development/core/history-service/-/archive/$pkgver/history-service-$pkgver.tar.gz
	0001-CMakeLists.txt-Add-ENABLE_WERROR-CMake-option-defaul.patch
	0002-upgrade-to-C-17.patch
	0003-remove-systemd-dependency.patch
	0004-remove-daemon-directory.patch
	"
builddir="$srcdir/history-service-$pkgver"
options="!check" # several tests timing out

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
		-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
		-DENABLE_WERROR=OFF
	cmake --build build
}

check() {
	ctest --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
73188367eb492375b1613ad10f45efd37b23cc0017955a12a89c375716268bb8bf1ba5ef024fae9798646312d3125d551549ffe44ad6c6e34fde60ba6d20fb42  history-service-0.4.tar.gz
00d0ff183864c08307cd8161f99b2b7a51df745e29cc6c920536f5c9fe712526805943c799e8e52e373af933698a70a79e1a0e9abb5fda95c3bd3f8ea765d7c3  0001-CMakeLists.txt-Add-ENABLE_WERROR-CMake-option-defaul.patch
ca24316555e14ac9a3f8f7420040b2803470efd312053020007009ae0273acbcf823c2c5cf0d6b88f2bbcd8430c248537e53e13a9c5855ccba17eac197cd9c4e  0002-upgrade-to-C-17.patch
328f346cbdea5d36a432e20076dbb0a765fbe5a45b96425756e7871e66fe204d415a3e38c48a71473c7c55b7947062637ff9098df77e36873b8057b6d76dcb2a  0003-remove-systemd-dependency.patch
5537768ff3ceda6fd4715adba63e8d34f97d2850e8137ca6efbb0614995c7c5b0ea83faef7b3b34e4b9e1c61910df47f113a1558088d510f0448f08cf28c7d7d  0004-remove-daemon-directory.patch
"
